/*将此文件上传到您的网站上，需要显示时间的地方加入：
<script language="javascript" src="clock.js"></script>
*/

var nyear;
var nmonth;
var nday=-1;
var nwday;
var nhrs;
var nmin;
var nsec;

function NewTick()
{
noww=new Date();
if(noww.getDate()!=nday){
nyear=noww.getFullYear();nmonth=noww.getMonth()+1;nwday=noww.getDay();nday=noww.getDate();
}
nhrs=noww.getHours();nmin=noww.getMinutes();nsec=noww.getSeconds();
}


document.write("<span id=\"clock\" style=\"word-break:keep-all\"></span>");

function Draw(){
NewTick();

//显示时间
var s=nyear+'年'+nmonth+'月'+nday+'日 '+'星期'+cweekday(nwday)/*+' '+shapetime(nhrs,nmin,nsec)*/;
document.getElementById("clock").innerHTML=s;

setTimeout("Draw()",500);
}

////辅助函数////
var hzWeek= new Array("日","一","二","三","四","五","六","日");
function cweekday(wday){return hzWeek[wday];}
function shapetime(vhrs,vmin,vsec){
if(vsec<=9) vsec="0"+vsec;if(vmin<=9) vmin="0"+vmin;
if(vhrs<=9) vhrs="0"+vhrs;return vhrs+":"+vmin+":"+vsec
}

//显示开始
Draw();
